<?php
class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
{
    public function _initAutoload(){
        $front = Zend_Controller_Front::getInstance();
        
        $front->registerPlugin(new Zend_Controller_Plugin_ErrorHandler(array(
                                'lang'     => 'vi',
                                'module'     => 'default',
                                'controller' => 'error',
                                'action'     => 'error'
        )));
        
        $front->registerPlugin(new Zend_Controller_Plugin_ErrorHandler(array(
                                'lang'     => 'vi',
                                'module'     => 'admin',
                                'controller' => 'error',
                                'action'     => 'error'
        )));
    }
     protected function _initCachemanager(){
        $cacheManager=new Zend_Cache_Manager;
        $dbcache=array(
            'frontend'=>array(
                'name'=>'Core',
                'options'=>array(
                    'lifetime'=>null,
                    'automatic_serialization'=>'true',
                ),
            ),
            'backend'=>array(
                'name'=>'File',
                'options'=>array(
                    'cache_dir'=>CACHE_DIR,
                ),
            ),
        );
        $cacheManager->setCacheTemplate('dbcache',$dbcache);
        return $cacheManager;
    }
    protected function _initDatabase(){
        $db = $this->getPluginResource('db')->getDbAdapter();
        Zend_Registry::set('db', $db);
        Zend_Session::start();
	}
        
    protected function _initRoutes()
    {
	
//        $frontController = Zend_Controller_Front::getInstance();
//        $params = $frontController->getParams();
//        $router = $frontController->getRouter();
//       
//        $router->addRoute(
//          'succontroller',
//          new Zend_Controller_Router_Route('/:controller/:action/:displayname',
//            array('lang' => 'vi',
//                  'module' => 'default',
//                  'controller' => 'index',
//                  'action' => 'success'
//            ),$params
//          )
//        );
    }
} 
